﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Spring.Transaction.Interceptor;

using Zeny.Common.Service;
using Zeny.Business.ExpSample.Dao;
using Zeny.Data.Domain.Exp;
using Zeny.Data.Domain.basedata;

namespace Zeny.Business.ExpSample.Service.Impl
{
    public class DepartmentService : BaseService, IDepartmentService
    {
        #region Properties

        public DepartmentDao departmentDao {get; set;}
        
        #endregion

        #region Methods

        [Transaction(ReadOnly = true)]
        public Department Get(string id)
        {
            log.Debug(id);
            return departmentDao.Get(id);
        }

        [Transaction(ReadOnly = true)]
        public IList<Department> GetAll()
        {
            return departmentDao.GetAll<Department>();
        }

        [Transaction(ReadOnly = true)]
        public bool existDeptCode(string deptCode)
        {
            return departmentDao.existDeptCode(deptCode);
        }

        [Transaction]
        public string Insert(Department entity)
        {
            log.Debug(entity);
            return departmentDao.Insert(entity);
        }

        [Transaction]
        public void Update(Department entity)
        {
            log.Debug(entity);
            departmentDao.Update(entity);
        }

        [Transaction]
        public void Delete(Department entity)
        {
            departmentDao.Delete(entity);
        }

        #endregion
    }
}
